package com.cnhis.drgs.core.xcode.ftl;

import com.cnhis.drgs.core.model.Column;
import com.cnhis.drgs.core.model.TableView;

import java.util.List;

public class FtlTemplateUtil {

    public static FtlTemplate getFtlTemplate(String name, String projectName, String basePackage, String mouduleName, boolean reserveSchema, TableView tableView, List<Column> columns) {
        try {
            Class<?> clazz = Class.forName("com.cnhis.drgs.core.xcode.ftl." + name.substring(0, 1).toUpperCase() + name.substring(1));
            return (FtlTemplate) clazz.getConstructor(FtlTemplate.class.getConstructors()[0].getParameterTypes()).newInstance(projectName, basePackage, mouduleName, reserveSchema, tableView, columns);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
